# OTA HTTP 服务 Makefile

# 编译器设置
CC = gcc
CFLAGS = -Wall -Wextra -g -O2
LDFLAGS = -lpthread

# 目标程序名称
TARGET = ota_http_server

# 源文件
SRC = ota_http.c

# 默认目标
all: $(TARGET)

# 创建目标程序
$(TARGET): $(SRC)
	@mkdir -p bin
	$(CC) $(CFLAGS) -o bin/$@ $^ $(LDFLAGS)

# 清理构建文件
clean:
	rm -rf bin $(TARGET)

# 运行程序
run:
	./bin/$(TARGET)

# 安装程序
install:
	cp bin/$(TARGET) /usr/local/bin/

# 显示帮助信息
help:
	@echo "Usage: make [target]"
	@echo "Targets:"
	@echo "  all       - 构建程序（默认）"
	@echo "  clean     - 清理构建文件"
	@echo "  run       - 运行程序"
	@echo "  install   - 安装程序到系统"
	@echo "  help      - 显示帮助信息"

.PHONY: all clean run install help